class Web:
#建構式
def __init__(self,url):
self.url=url
driver.get(url)
#走訪(遍歷)網頁的元素,並對其進行操作(爬取資料/填入資料/點擊/下載圖片)
def travel(self,q_list,operation):#q_list={'Xpath':[' '],...}
for k,v in q_list.items():
elements=driver.find_elements_by_xpath(k)
if(operation=='get_data'):
for elem in elements:
v.append(elem)